﻿// Copyright (c) 2013 Bryan C. O'Connell
// http://wsubi.codeplex.com/license
// Purpose: Geta translates to a "wooden block used as a plate". This class 
// represents the results of the Chef's (Itamae) work so it can be shared and 
// consumed, or essentially "served" to the user.

using System;
using System.Collections.Generic;

namespace Wsubi
{
    class Geta
    {
        /// <remarks>All-in-one constructor. Just pass in the values, and you're ready to serve.</remarks>
        /// <param name="ResultSet">Results to share.</param>
        /// <param name="PresentOn">How results should be presented.</param>
        /// <param name="SortResults">Whether to sort results.</param>
        public Geta(List<string> ResultSet, OutputsTo PresentOn, bool SortResults = false) 
        {
            _Results = ResultSet;
            _Presentation = PresentOn;

            if (_Results.Count == 0)
            {
                _Results.Add("So sorry, no results were found.");
            }

            if (SortResults)
            {
                _Results.Sort();
            }
        }

        /// <summary>Basic constructor. Use when you want to add results manually.</summary>
        /// <param name="PresentOn">How results should be presented.</param>
        public Geta(OutputsTo PresentOn = OutputsTo.Screen)
        {
            _Results = new List<string>();
            _Presentation = PresentOn;
        }

        /// <summary>Adds a value to the current result set.</summary>
        /// <param name="Value">Value to add.</param>
        public void AddResult(string Value)
        {
            _Results.Add(Value);
        }

        /// <summary>Results to share.</summary>
        private List<string> _Results;
        public List<string> Results
        { get { return _Results; } }

        /// <summary>How results should be presented.</summary>
        private OutputsTo _Presentation;
        public OutputsTo Presentation
        { get { return _Presentation; } }
    }
}
